package com.design.boot.service.impl;

import com.design.boot.mapper.mytest.UserMapper;
import com.design.boot.model.User;
import com.design.boot.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author kakayubei
 * @description
 * @date 2021/7/31 10:58
 */
@Service
public class UserServiceImpl implements UserService {

        @Resource
        private UserMapper userMapper;

        @Override
        public int deleteByPrimaryKey(Long id) {
            return userMapper.deleteByPrimaryKey(id);
        }

        @Override
        public int insert(User record) {
            return userMapper.insert(record);
        }

        @Override
        public int insertSelective(User record) {
            return userMapper.insertSelective(record);
        }

        @Override
        public User selectByPrimaryKey(Long id) {
            return userMapper.selectByPrimaryKey(id);
        }

        @Override
        public int updateByPrimaryKeySelective(User record) {
            return userMapper.updateByPrimaryKeySelective(record);
        }

        @Override
        public int updateByPrimaryKey(User record) {
            return userMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<User> getAllUser() {
        ArrayList<User> users = new ArrayList<>();
        users.add(User.builder().name("LL").age(27).address("Bj").build());
        users.add(User.builder().name("LC").age(26).address("Bj").build());

        return users;
    }
}
